<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8" %>
<%@ page import="com.aeks.user.*, com.aeks.show.*" %>
<%@ page import="java.util.List,java.util.ArrayList, java.util.Map"%>

<%
	String username = (String)session.getAttribute("username");
	 User u = null;
	if(username == null || username.trim().equals("")) {
		response.sendRedirect("login.html");
		return;
	} else {
		List<User> user = AboutUser.getUser(username);
		if(user != null && user.size() > 0) {
			u = (User)user.get(0);
		}
	}
	
	List<String> article = null;
	List<Map> key = null;
	List<String> stop = null;
	List<Map> list = null;
	
	String action = request.getParameter("action");
	String status = "before";
	if(action != null && action.equals("dealSuccess")) {
		boolean isSuccess = true;
		status = "after";
		String fileID = request.getParameter("fileID");
		String servletPath = "F:\\software\\tomcat\\webapps\\AEKS\\";
		System.out.println("fileid:" + fileID + "    servletPath:" + servletPath);
		article = new ArrayList<String>();
		key = new ArrayList<Map>();
		stop = new ArrayList<String>();
		list = new ArrayList<Map>();
		
		String saveName = "";
		String fileName = "";
		list = FinalShow.getLoadFile(fileID);
			System.out.println(list.size());
		if(isSuccess && list != null && list.size() > 0) {
			Map map = list.get(0);
			saveName = (String)map.get("savename");
			fileName = (String)map.get("filename");
		} else {
			isSuccess = false;
		}
		
		if(isSuccess && saveName != null && !saveName.equals("")&& fileName != null && !fileName.equals("")) {
			article = FinalShow.getArticle(saveName, fileName, servletPath);
			key = FinalShow.getKey(fileID);
			stop = FinalShow.getStop(saveName, servletPath);
			if(article != null && article.size()>0 && key != null && key.size() >0 && stop != null && stop.size() > 0) {
				isSuccess = true;
			} else {
				isSuccess = false;
			}
		} else {
			isSuccess = false;
		}
		
		if(isSuccess) {
			status = "after";
		} else {
			status = "before";
		}
	}
	
	String articleString = "";
	String stopString = "";
	String keyString = "";
	if(status != null && status.equals("after")) {
		for(int i=0; i<article.size(); i++) {
			articleString += article.get(i);
		}
		
		for(int i=0; i<stop.size(); i++) {
			stopString = stopString + stop.get(i) + "/";
		}
		
		for(int i=0; i<key.size(); i++) {
			Map map = key.get(i);
			String k = (String)map.get("keyvalue");
			float v = (Float)map.get("cvalue");
			String s = k + ":  " + v;
			System.out.println(s);
			keyString = keyString + s + "\n";
		}
	}
	
	
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="ctl00_Head1">
	<title>文献自动抽词标引系统</title>
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
	<meta name="keywords" content="文献自动抽词标引系统">
	<meta name="description" content="文献自动抽词标引系统">
	<link href="css/StyleSheet.css" rel="stylesheet" type="text/css">
	<link href="css/basis_main.css" type="text/css" rel="stylesheet">
	<script language="javascript" src="js/mine.js" ></script>
	<style>
		a {
			text-decoration: none
		}
		
		a {
			color: #4b4b4b;
			text-align: left;
		}
		
		A:hover {
			COLOR: #366eec;
			TEXT-DECORATION: underline
		}
	</style>
</head>

<body topmargin="0" style="font-family: 宋体; background-repeat: repeat; ">
	<div>
		<input name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTE5NDgxOTkxNmRk" type="hidden">
	</div>

	<div style="vertical-align: top; padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0px;" align="center">
		<table border="0" cellpadding="0" cellspacing="0" width="950">
			<tbody>
				<tr>
					<td colspan="6" style="vertical-align: middle; text-align: center; background-color: #ffffff;" width="950">
						<div style="text-align: right">
							<table border="0" cellpadding="0" cellspacing="0" width="950">
								<tbody>
									<tr>
										<td style="text-align: center; height: 2px;"></td>
									</tr>
									<tr>
										<td	style="height: 85px; text-align: left; vertical-align: middle;">
											<table>
												<tbody>
													<tr>
														<td rowspan="1" style="vertical-align: middle; height: 64px;" width="200">
															<img src="images/logo4.gif" alt="澜科语言科技" border="0">
														</td>
														<td rowspan="1" style="width: 739px; height: 64px; text-align: center" colspan="2">
															<span style="font-size: 14pt; color: #11427b"><strong>信息检索与信息系统课程设计:文献自动抽词标引系统</strong></span>
														</td>
													</tr>
												</tbody>
											</table>
										</td>
									</tr>
									<tr>
										<td style="width: 800px; height: 60px; text-align: center; background-color: #dce6ff;" bgcolor="#cdf2ff">
											<div id="navarea">
												<ul id="nav">
													<li><%= username %>, 欢迎登陆文献自动抽词标引系统</li>
													<li><a href="quit.jsp">退出</a></li>
													</ul>
											</div>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</td>
				</tr>
				<tr>
					<td rowspan="3" style="vertical-align: top; text-align: left; width: 190px; border-top-width: thin; border-left-width: thin; border-left-color: whitesmoke; border-bottom-width: thin; border-bottom-color: whitesmoke; border-top-color: #f4f4f9; background-repeat: repeat-y; border-right-width: thin; border-right-color: #f4f4f9; background-color: #ffffff;"	height="100">
						<table style="background-repeat: repeat;" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
							<tbody>
								<tr>
									<td	style="vertical-align: top; height: 10px; text-align: left">
										<img id="ctl00_Image1" src="images/kstd.gif" style="border-width: 0px;">
									</td>
								</tr>
								
								<tr>
									<td style="vertical-align: top; height: 100px; text-align: center">
										<form name="paramSet" id="paramSet" method="post" action="SetParamServlet"  onsubmit="return checkParam();">
										<input type="hidden" name="action" value="setparam" />
										<table style="WIDTH: 160px; HEIGHT: 210px" border="0" cellpadding="0" cellspacing="0">
											<tbody>
												<tr>
													<td colspan="2" height="4"></td>
												</tr>
												<tr>
													<td	style="WIDTH: 50%; text-align: center; border-bottom: #eff7ff thin solid;">
														引用源
													</td>
													<td
														style="WIDTH: 50%; TEXT-ALIGN: left; border-bottom: #eff7ff thin solid;">
														权值
													</td>
												</tr>
												<tr>
													<td
														style="WIDTH: 50%; text-align: center;; border-bottom: #eff7ff thin solid;">
														题名：
													</td>
													<td
														style="WIDTH: 50%; TEXT-ALIGN: left; border-bottom: #eff7ff thin solid;">
														<input type="text" name="titleValue" id="titleValue" size="10" value="<%= u.getTitleValue() %>"/>
													</td>
												</tr>
												<tr>
													<td
														style="WIDTH: 50%; text-align: center;; border-bottom: #eff7ff thin solid;">
														摘要：
													</td>
													<td
														style="WIDTH: 50%; TEXT-ALIGN: left; border-bottom: #eff7ff thin solid;">
														<input type="text" name="briefValue" size="10" value="<%= u.getBriefValue() %>" />
													</td>
												</tr>
												<tr>
													<td
														style="WIDTH: 50%; text-align: center;; border-bottom: #eff7ff thin solid;">
														关键字：
													</td>
													<td
														style="WIDTH: 50%; TEXT-ALIGN: left; border-bottom: #eff7ff thin solid;">
														<input type="text" name="keyValue" size="10" value="<%= u.getKeyValue() %>"/>
													</td>
												</tr>
												<tr>
													<td
														style="WIDTH: 50%; text-align: center;; border-bottom: #eff7ff thin solid;">
														正文：
													</td>
													<td
														style="WIDTH: 50%; TEXT-ALIGN: left; border-bottom: #eff7ff thin solid;">
														<input type="text" name="textValue" size="10" value="<%= u.getTextValue()%>"/>
													</td>
												</tr>
												<tr>
													<td
														style="WIDTH: 50%; text-align: center;; border-bottom: #eff7ff thin solid;">
														阀值：
													</td>
													<td
														style="WIDTH: 50%; TEXT-ALIGN: left; border-bottom: #eff7ff thin solid;">
														<input type="text" name="limitValue" size="10" value="<%= u.getLimitValue() %>"/>
													</td>
												</tr>
												<tr>
													<td style="TEXT-ALIGN: center; height: 6px;" colspan="2">
													<input type="submit" value="修改" />
												</tr>
											</tbody>
										</table>
										</form>

									</td>
								</tr>

							</tbody>
						</table>
					</td>
					<td colspan="1" rowspan="3" style="border-top-width: 10px; background-position-x: right; border-left-width: 10px; border-left-color: #ffffff; border-bottom-width: 10px; border-bottom-color: aliceblue; vertical-align: middle; border-top-color: #ffffff; background-repeat: repeat; text-align: left; border-right-width: 10px; border-right-color: #ffffff; width: 2px; background-color: aliceblue;">
					</td>
				</tr>
				
				
				
				<tr>
					<td style="vertical-align: top; text-align: left; padding-top: 10px; padding-right: 5px; padding-left: 5px; line-height: 20pt; background-color: #ffffff; height: 300px; padding-bottom: 10px; border-top-width: thin; border-left-width: thin; border-left-color: aliceblue; border-bottom-width: thin; border-bottom-color: aliceblue; border-top-color: aliceblue; border-right-width: thin; border-right-color: aliceblue;"
						class="body" width="740">
						<table border="2" bordercolor="aliceblue" width="650">
							<tbody>
								<tr>
									<td width="340">
										<form name="selectFile" method="post" enctype="multipart/form-data" action="FileDealServlet" onsubmit="return checkLoad()">
											请选择要进行抽词的文献：（只支持txt文件）
											<input type="file" name="file" name="loadFile" id="loadFile" />
											<input type="submit" value="确定"/>
										</form>
									</td>
									<td style="vertical-align: middle; text-align: center" width="340">
										<form method="post" action="AddStopServlet" name="add" onsubmit="return checkAdd()">
										<input type="hidden" name="action" value="add" />
											本系统支持用户添加听用词的功能<br/>
											添加停用词:<input type="text" id="addStop" name="addStop"/><input type="submit" value="添加"/>
										</form>
									</td>
								</tr>
								<tr>
									<td colspan="2">
									</td>
								</tr>
								<tr>
									<td width="340">
										<span id="ctl00_text_Label4"
											style="display: inline-block; background-color: AliceBlue; width: 340px;">原文显示框，待处理文章</span>
										<br>
											<textarea name="ctl00$text$TextBox1" rows="2" cols="20"
												id="ctl00_text_TextBox1"
												style="border-color: Transparent; height: 500px; width: 340px;">
												<% 
													if(status != null && status.equals("after")) {
														out.println(articleString);
													}
												%>
												</textarea>
									</td>
									<td style="width: 340px">
										<span id="ctl00_text_Label1" style="display: inline-block; background-color: AliceBlue; width: 340px;">关键词</span>
										<textarea name="ctl00$text$TextBox2" rows="2" cols="20" id="ctl00_text_TextBox2" style="border-color: Transparent; height: 280px; width: 340px;">
										<% 
													if(status != null && status.equals("after")) {
														out.println(keyString);
													}
												%>
										</textarea>
										
										<span id="ctl00_text_Label3" tyle="display: inline-block; background-color: AliceBlue; width: 340px;">分词</span>
										<textarea name="ctl00$text$TextBox4" rows="2" cols="20" id="ctl00_text_TextBox4" style="border-color: Transparent; height: 200px; width: 340px;">
										<% 
													if(status != null && status.equals("after")) {
														out.println(stopString);
													}
												%>
										</textarea>
									</td>
								</tr>
							</tbody>
						</table>


					</td>
				</tr>
				<tr>
					<td colspan="6"
						style="vertical-align: middle; text-align: center; background-position-y: bottom;  background-repeat: repeat-x;"
						height="50" width="950">
					</td>
				</tr>
				<tr>
					<td colspan="6"
						style="vertical-align: middle; text-align: center; height: 80; background-color: #ffffff;"
						height="50" width="950">


						<table align="center" border="0" cellpadding="0" cellspacing="0"
							width="950">
							<tbody>
								<tr>
									<td style="background-color: #689dbb" align="center"
										bgcolor="#1d79a5" height="28">
										<font color="#ffffff"><span>版权所有 2013&nbsp;
												重庆邮电大学</span>
										</font>
									</td>
								</tr>
								<tr>
									<td
										style="background-position-y: top;  background-repeat: repeat-x"
										align="center" height="55">
										<p>
											Tel：xxxxxx
											<br>
												<font color="#696969">地址：重庆南岸区崇文路2号</font>
										</p>

										<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://"
		: " http://");
												
</script>
												<script src="js/h.js" type="text/javascript">
</script>


											</td>
										</tr>
									</tbody>
								</table>

							</td>
						</tr>
					</tbody>
				</table>

			</div>
	</body>
</html>